﻿using System;
using System.Collections.Generic;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WebStore.Domain.Entities.Model
{
    public class UserRole
    {
        public int Id { get; set; }

        public int UserId { get; set; }
        public virtual User User { get; set; }

        public int RoleId { get; set; }
        public virtual Role Role { get; set; }
    }

    public class UserRoleConfiguration:EntityTypeConfiguration<UserRole>
    {
        public UserRoleConfiguration()
        {
            HasRequired(x => x.User).WithMany().HasForeignKey(x => x.UserId);
            HasRequired(x => x.Role).WithMany().HasForeignKey(x => x.RoleId);
        }
    }
}
